<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <% 
       String path =  request.getContextPath();
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Vantop-SBA-下载地址</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" type="text/css" href="<%=path%>/css/bootstrap.css"/>
    </head>
    <body>
       <form role="form" class="form-horizontal" id="downform" action="" method="post" enctype="multipart/form-data">
		<div class="panel panel-primary">
		   <div class="panel-body">
		   <a href="javascript:createQRCode();"></a>
		   		<div class="form-group">
                    <a class="col-md-2 control-label" for="dcreateQrcode" href="javascript:createQRCode();" >生成二维码</a>
                    <div class="col-md-8">
                    <span style="color:blue;font-size:15px;"> 服务器默认地址：D:\Sweep_the_code_download_service\vantop_sba\qrcode\vantop-xinchouxing-1.0.JPG</span>
                        <!-- <div class="col-md-8" id="qrcodeImg">
                    	</div> -->
                    </div>
                </div>
		        <div class="form-group">
                    <label class="col-md-2 control-label" for="downLoadUrl">下载地址</label>
                    <div class="col-md-8">
                        <a style="cursor:pointer" id="download" href="javascript:download();">点击下载</a>
                    </div>
                </div>
		   </div>
		</div>
		<input type="hidden" name="ostype" id="ostype"/>
		</form>
		<script src="<%=path%>/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="<%=path%>/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
	        var ostype;
	        var path="<%=path%>";
	        $(function(){
	        	   var u = navigator.userAgent, app = navigator.appVersion;
	               var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
	               var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
	               var type="";
	               if(isiOS){
	            	   ostype="ios";
	               }else{
	            	   ostype="android";
	               }
	               
	               <%-- $("#download").click(function(){
	            	   alert($("ostype").val());
	                  	var path="<%=path%>";
	                  	path+="/apk/download.do";
	                  	$('#downform').attr("action", path).submit();
	               }); --%>
	        });
	        
	        var download = function(){
	        	if(ostype == 'ios'){
	        		window.location.href = "itms-services://?action=download-manifest&url=https://raw.githubusercontent.com/superman010/vantop-sba/master/src/main/webapp/vantop.plist";
	        	}else{
	      			window.location.href = "http://123.58.230.241:6001/android/vantop_5_SBA.apk";
	        	}
	      	}
	        
	        var createQRCode = function(){
	      		$.ajax({
	      			type: "get",
	      			url: path + "/apk/createQRCode.do",
	      			dataType: "text",
	      			success: function(data){
	      				//$('#qrcodeImg').empty();
	      				//$('#qrcodeImg').append('<span style="color:blue;font-size:15px;"> 服务器默认地址：D:\\Sweep_the_code_download_service\\vantop_sba\\qrcode\\vantop-xinchouxing-1.0.JPG</span>');
	      			}
	      		});
	      	}
        
        </script>
    </body>
</html>